export const  validateAccount = (rule, value, callback) => {
   if (value === '') {
     callback(new Error('请输入账号'));
   } else if (!/^[a-zA-Z0-9\u4E00-\u9FA5]{3,16}$/.test(value)) {
       callback(new Error('用户名，3到16位（字母，数字 ，中文）')); 
     } else{
      callback(); 
     }
     
  
 };
 export const  validatePassword = (rule, value, callback) => {
   if (value === '') {
     callback(new Error('请输入密码'));
   } else if (!/^[a-zA-Z0-9]{3,16}$/.test(value)) {
       callback(new Error('密码，3到16位（字母，数字）')); 
     } else{
       // 成功必须调用callback  否则小图标一直加载
      callback(); 
     }
 };
 export const setaddZero = v=>v>10?v:'0'+v

 export const formateDate = (time)=>{
   let date = new Date(time)
   let y = date.getFullYear()
   let M = date.getMonth()+1
   let d = date.getDay()
   let h = date.getHours()
   let m = date.getMinutes()
   let s = date.getSeconds()
console.log(y,M,d,h,m,s);

let arr=[y,M,d,h,m,s].map(v=>setaddZero(v))
return arr.slice(0,3).join('-') + ' ' + arr.slice(3).join(':')
 }

